package com.ycj.design.structure.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * 动态处理器
 * @author xiyang.ycj
 * @since Nov 21, 2019 18:01:09 PM
 */
public class Dynamic implements InvocationHandler {


    private Object target;

    public Dynamic(Object target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("中介--买车记录---找到车源");
        Object invoke = method.invoke(this.target, args);
        System.out.println("中介--买车记录---交易完成--记录业绩");
        return invoke;
    }
}
